import { Fragment, React } from 'react';
import { Provider } from 'react-redux';
import { Globalstyle } from './style';
import Header from './common/header';
import { GlobalstyleIconfont } from './statics/iconfont/iconfont';
import store from './store';
// 引入 react-router-dom
import { BrowserRouter, Route } from 'react-router-dom';
// 页面拆分：引入页面
import Home from './pages/home';
import Detail from './pages/detail/loadable';
import Login from './pages/login'
import Write from './pages/write';

  function App() {
    return (
      <Fragment>
          <Provider store={store}>
          <Globalstyle />
          <GlobalstyleIconfont/>
          <BrowserRouter>
            <Header />
            <Route path='/' exact component={Home}></Route>
            <Route path='/detail/:id' exact component={Detail}></Route>
            <Route path='/login' exact component={Login}></Route>
            <Route path='/write' exact component={Write}></Route>
          </BrowserRouter>
        </Provider>
      </Fragment>
    );
  }

  export default App;
